package com.infoview.db;

import java.io.IOException;
import java.util.Properties;

import org.jivesoftware.webchat.util.Files;

public class DbConfig extends Properties{
	private static final long serialVersionUID = 1L;
	
	private static final String DRIVER_NAME = "driver_name";
	private static final String URL = "url";
	private static final String USERNAME = "username";
	private static final String PASSWORD = "password";
	
	
	private static DbConfig instance = new DbConfig();
	private DbConfig() {
		try {
			/**上传图片*/
	    	Files f=new Files();
	    	f.upFiles();
			load(DbConfig.class.getResourceAsStream("/dbconfig.properties"));
		} catch (IOException e) {
			System.out.println("加载配置文件config.properties出错！");
			e.printStackTrace();
			
		}
	}
	
	public static String getDriverName() {
		return instance.get(DRIVER_NAME).toString();
	}
	
	public static String getUrl() {
		return instance.get(URL).toString();
	}
	
	public static String getUserName() {
		return instance.get(USERNAME).toString();
	}
	
	public static String getPassword() {
		return instance.get(PASSWORD).toString();
	}
}
